package com.bowen.demo.demo006;

/**
 * <h3>java-study</h3>
 * <p>模拟线程进行秒杀服务</p>
 * // 参考：https://m.php.cn/faq/466231.html
 * @author : zhang.bw
 * @date : 2021-03-26 18:06
 **/
public class ThreadA extends Thread {

	private Service service;
	public ThreadA(Service service) {
		this.service = service;
	}

	@Override
	public void run() {
		// 秒杀
		service.seckill();
	}

	public static void main(String[] args) {
		Service service = new Service();
		for (int i = 0; i < 50; i++) {
			ThreadA threadA = new ThreadA(service);
			threadA.start();
		}
	}
}